-- In case you are wondering where intial spawn, loadout, etc are, they are located in init.lua
-- This file is meant for holding hooks that may be helpful when developing shit.
Lusion_Teams = {}
Lusion_Gangs = {}
-- If Bool_NeedsFlag is true then the player will be required to have the flag equal to the String_IDName.
function LUSION:CreateTeam( String_MenuName, String_TIDName, Int_Salary, String_TDescription, Color, Table_Weapons, Int_MaxPlayers, Bool_TNeedsFlag )
	if not (String_MenuName or String_TIDName or Int_Salary or String_TDescription or Color or Table_Weapons or Int_MaxPlayers) then return end
	if not Bool_TNeedsFlag then Bool_TNeedsFlag = false end
	
	table.insert(Lusion_Teams, { menuName = String_MenuName, idName = String_TIDName, salary = Int_Salary, description = String_TDescription, color = Color, weapons = Table_Weapons, maxplayers = Int_MaxPlayers, needsFlag = Bool_TNeedsFlag } )
	team.SetUp(#Lusion_Teams, menuName, color )
	
	return #Lusion_Teams
end
-- Purpose: Create a gang/faction/whateverthehellyoucallit
-- To use: Create a gang, and then customize jobs/teams to be in that gang.
-- Args: Gang name (String),	Gang ID (ex: "gambriel" NO spaces) (String), 	Description (String),	Needs a flag (Only should be used for people joining gangs on their own) (Boolean)
-- Is used/supported: Not yet. Planning on it soon. (as of 1/18)
function LUSION:CreateGang( String_GangName, String_GIDName, String_GDescription, Bool_GNeedsFlag )	-- Protip: When creating a gang, it doesn't neccesarily mean that it HAS to be a gang.
	if not (String_GangName or String_GIDName or String_GDescription) then return end
	if not Bool_GNeedsFlag then Bool_GNeedsFlag = false end
	
	table.insert(Lusion_Gangs, { gangName = String_GangName, gidName = String_GIDName, gdescription = String_GDescription, gneedsFlag = Bool_GNeedsFlag } )

	return #Lusion_Gangs
end
-- Purpose: Hook to whenever a player recieves a paycheck. Modders may now make a bank system without modifying core.
-- To use: Make a function, and create a hook calling this function. -- hook.Add("OnPlayerPaycheck", "uniquename", functioname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: Yep.
function LUSION:OnPlayerPaycheck( pl )
	if hook.GetTable()["OnPlayerPaycheck"] == nil or table.Count(hook.GetTable()["OnPlayerPaycheck"]) < 1 then 	-- If there are no hooks calling this
		if not ValidEntity( pl ) then timer.Destroy( "Give_Paycheck_To_"..pl:GetLusionID() ) return else
			if pl:GetMoney() < GAMEMODE.config["Max Wallet"] then
				pl:PlayerNote("Paycheck recieved! Profited ".. GAMEMODE.config["Currency"] .. "" .. pl:GetTeamPaycheck() .. " as ".. ParseVowels(Lusion_Teams[pl:Team()].menuName) .. " ".. Lusion_Teams[pl:Team()].menuName, 7)
				pl:AddMoney( pl:GetTeamPaycheck() )
			end
		end
	end
end
-- Purpose: Hook to whenever a player joined a team/job. This is called AFTER the player joins the team/job.
-- To use: Make a function, and create a hook calling this function. -- hook.Add("OnPlayerJoinedTeam", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: Yes. (As of 1/18)
function LUSION:OnPlayerJoinedTeam( pl )
	if hook.GetTable()["OnPlayerJoinedTeam"] == nil or table.Count(hook.GetTable()["OnPlayerJoinedTeam"]) < 1 then 	-- If there are no hooks calling this
		pl:StripWeapons()
		pl:Give("weapon_physcannon")
		pl:CrosshairEnable()
		if pl:Team() == GAMEMODE.DefaultTeam then pl:CrosshairDisable() end
		for k,v in pairs(Lusion_Teams[pl:Team()].weapons) do
			pl:Give(v)
		end
	end
end
-- Purpose: Hook to whenever a player is about to join a team/job. This is called right as the player attempts to join the team/job.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerRequestTeam", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: Yes. (As of 1/18)
function LUSION:OnPlayerRequestTeam( pl )	-- I probably should put the job join code in here, but I'm not going to bother.
end
-- Purpose: Hook whenever a player has been jailed. Called right after a player has been jailed.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerArrested", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: YES. (As of 2/1)
function LUSION:OnPlayerArrested( pl, target )
end
-- Purpose: Hook whenever a player has been unjailed. Called right after a player has been unjailed.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerUnArrested", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: YES. (As of 2/1)
function LUSION:OnPlayerUnArrested( pl, target )
end
function LUSION:OnPlayerUnarrested( pl, target )
end
-- Purpose: Hook whenever a player "regenerates" some health. Called right after a player gets this health change.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerRegainedHealth", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\),	New health (Player's new health after they regained some.)
-- Is used/supported: Yessir. (As of 1/18)
-- Last updated: 1/22; Removed timer in default code below, wasn't needed.
function LUSION:OnPlayerRegainedHealth( pl, newhealth ) -- Soon to hold oldhealth too.
	if hook.GetTable()["OnPlayerRegainedHealth"] == nil or table.Count(hook.GetTable()["OnPlayerRegainedHealth"]) < 1 then	-- If there are no hooks calling this
		if pl:Health() > 200 then
			pl:SetHealth(200)
		end
		pl:ChatPrint("Healed! Your new health: " .. newhealth)
	end
end
-- Purpose: Hook whenever a player loses some heath. Only is called when their new hp is above 0. Does not communicate with the client.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerLostHealth", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\),	New hleath (Player's new health after they regained some.)
-- Is used/supported: Yeah. Yearp. (As of 1/20)
-- Last updated: 1/21; Added oldhealth
function LUSION:OnPlayerLostHealth( pl, oldhealth, newhealth )
	if hook.GetTable()["OnPlayerLostHealth"] == nil or table.Count(hook.GetTable()["OnPlayerLostHealth"]) < 1 then -- If there are no hooks calling this
		pl:ChatPrint("Hurt! Your new health: " .. newhealth .. "; Your old health was " .. oldhealth .. "! You lost " .. oldhealth - newhealth .." hp.")
	end
end
-- Purpose: Hook whenever a player buys a prop. Called right after a player buys the prop.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerBoughtProp", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\),	Propmodel (Prop model that the player bought.)
-- Is used/supported: Yes. Well, it's complicated. (As of 1/18)
function LUSION:OnPlayerBoughtProp( pl, propmodel )
	if hook.GetTable()["OnPlayerBoughtProp"] == nil or table.Count(hook.GetTable()["OnPlayerBoughtProp"]) < 1 then	-- If there are no hooks calling this
		pl:ChatPrint("You just bought " .. propmodel)
	end
end
-- Purpose: Hook whenever a player removes a prop. Called right after a player sells the prop.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerSoldProp", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: Planned soon (As of 1/19)
function LUSION:OnPlayerSoldProp( pl )
end
-- Purpose: Hook whenever a player buys a door. Called right after a player buys a door.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerBoughtDoor", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: Soon. (As of 1/19)
function LUSION:OnPlayerBoughtDoor( pl )
end
-- Purpose: Hook whenever a player sells a door. Called right after a player buys a door.
-- To use: Make a function, and create the hook calling this function. -- hook.Add("OnPlayerSoldDoor", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: Soon. (As of 1/19)
function LUSION:OnPlayerSoldDoor( pl )
end

-- Purpose: Hook whenever a player requests to buy a door. Returns true if they can, false if they cannot.
-- To use: Make a function,, and create the hook calling this function. -- hook.Add("CanPlayerBuyDoor", "uniquename", functionname)
-- Args: Player (Should be obvious on what this does :\)
-- Is used/supported: Soon. (As of 1/19)
function LUSION:CanPlayerBuyDoor( pl )
	return true	-- When I add things like arresting and stuff, then I will edit this function.
end
-- You'd be surprised, I might use this sometimes as well.
function LUSION:PlayerCanBuyDoor( pl )
	return self:CanPlayerBuyDoor( pl )
end